#ifndef CONFIGURATION_H
#define CONFIGURATION_H

#include <iostream>
#include "vector"

#include "ngl/Camera.h"
#include "ngl/SpotLight.h"
#include "ngl/Colour.h"

#include "ShaderObject.h"
#include "ClothMaterial.h"


/// @file Configuration.h
/// @brief parses xml config file
/// @author Perseedoss Rajiv
/// @version 1.0
/// @date 29.03.11
/// Revision History :
/// Initial Version 29.03.11
/// @class Configuration
/// @brief static class that deals with reading of xml configuration file and initialisations

class Configuration
{
public:
    /// @brief debug parameter used in all the files to enable debugging and console output
    static bool s_debug;

    /// @brief acceleration due to gravity(free fall) value
    static float s_accelerationOfFreeFall;

    /// @brief particle normal default colour
    static ngl::Colour s_normalColour;

    /// @brief particle main colour when in neighbour-trace mode
    static ngl::Colour s_mainTraceColour;

    /// @brief particle default neighbour colour when in neighbour-trace mode
    static ngl::Colour s_neighbourTraceColour;

    /// @brief particle structural neighbour colour when in neighbour-trace mode
    static ngl::Colour s_structuralNeighbourTraceColour;

    /// @brief particle shear neighbour colour when in neighbour-trace mode
    static ngl::Colour s_shearNeighbourTraceColour;

    /// @brief particle flex neighbour colour when in neighbour-trace mode
    static ngl::Colour s_flexNeighbourTraceColour;

public :
    /// @brief set global parameters from the config file
    /// @param[out] o_frameRate the frame rate for the simulation
    /// @param[out] o_mouseMoveSensitivity sensitivity value of the mouse (x,y) movement
    static void initialiseWindow
                            (
                                int &o_frameRate,
                                int &o_mouseMoveSensitivity
                            );

    /// @brief create and return a camera from config file parameters
    /// @param[in] _aspect the aspect ratio to be used for the camera creation
    static ngl::Camera initialiseCamera(const float _aspect);

    /// @brief create and return a light source from config file parameters
    static ngl::Light initialiseLight();

    /// @brief create and return the list of shaders from config file parameters
    static std::vector<ShaderObject*>* initialiseShader();

    /// @brief create and return the list of cloth materials
    static std::vector<ClothMaterial*>* initialiseClothMaterials();

    /// @brief set the global parameters of the obstacles
    /// @param[out] o_cubeEnabled toggle cube obstacle
    /// @param[out] o_cubePosition position of cube
    /// @param[out] o_cubeDimension size of cube
    /// @param[out] o_sphereEnabled toggle sphere obstacle
    /// @param[out] o_spherePosition position of sphere
    /// @param[out] o_sphereRadius radius of sphere
    static void initialiseObstacles
                            (
                                bool &o_cubeEnabled,
                                ngl::Vector &o_cubePosition,
                                ngl::Vector &o_cubeDimension,
                                bool &o_sphereEnabled,
                                ngl::Vector &o_spherePosition,
                                int &o_sphereRadius
                            );

private:
    /// @brief the path of the configuration xml file
    static std::string s_settingsDoc;

private:
    /// @brief utility function to split a string into a vector of floats
    /// @param[in] _str the input string to be split
    /// @param[in] _d the count of split parts to be used as the size of the vector
    static std::vector<float> getFloatVectorFromString
                                            (
                                                const std::string _str,
                                                const int _d
                                            );


};

#endif // CONFIGURATION_H
